<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            Protesto - #{managerCriarProtesto.protesto.id == null ? 'Cadastrar' : (managerCriarProtesto.visualizar ? 'Visualizar':'Editar')}
            <script>
                function title() {
                    document.getElementById('protesto').className='selected';
                }
                window.onload=title;
            </script>
        </ui:define>

        <ui:define name="content">
            <h:form id="criarProtestoForm" enctype="multipart/form-data"   >   
                <p:growl id="criarProtestoMessages" autoUpdate="true" />

                <div class="row">
                    <div class="column3" style="float: right;">
                        <div class="column12">
                            <p:button value="Visualizar" 
                                      rendered="#{managerCriarProtesto.protesto.id ne null and managerCriarProtesto.visualizar}"
                                      outcome="criarProtesto.xhtml" styleClass="right ui-priority-primary"
                                      icon="ui-icon-search">
                                <f:param value="#{managerCriarProtesto.protesto.id}" name="protestoId"/>
                                <f:param value="visualizar" name="true"/>
                            </p:button>
                        </div>

                    </div>
                </div>
                <div class="clear"/>
                <fieldset>
                    <legend> <h4 style="margin:0 0 10px 0">Protocolo</h4></legend>

                    <p:panel styleClass="column12" id="protocoloPanel" 
                             style="background: none; border: none;" >

                        <div class="row">
                            <div class="column1">
                                <p:outputLabel value="Protocolo" for="protocoloInputText" />
                            </div>
                            <div class="column2">
                                <p:inputText id="protocoloInputText" 
                                             autocomplete="false"
                                             readonly="#{managerCriarProtesto.visualizar}"
                                             value="#{managerCriarProtesto.codigoProtocolo}"
                                             required="true" requiredMessage="Protocolo é obrigatório"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '', aDec: '', vMin:0, wEmpty: '0', mDec: 0});" >
                                    <p:ajax event="blur" listener="#{managerCriarProtesto.loadProtocolo}" update="@this, @form" />
                                </p:inputText>
                            </div>
                            <div class="column2">
                                <p:outputLabel value="Data Protocolo" for="dataProtocoloCalendar" />
                            </div>
                            <div class="column2">
                                <p:calendar readonly="true" id="dataProtocoloCalendar"
                                            value="#{managerCriarProtesto.protocolo.dataCadastro}"
                                            pattern="dd/MM/yyyy" locale="pt" navigator="true" />
                            </div>
                            <div class="column1">
                                <p:outputLabel value="Livro" for="livroInputText" />
                            </div>
                            <div class="column1">
                                <p:inputText id="livroInputText"  readonly="true"  value="#{managerCriarProtesto.protocoloItem.livro}"/>
                            </div>
                            <div class="column1">
                                <p:outputLabel value="Folha" for="folhaInputText" />
                            </div>
                            <div class="column1">
                                <p:inputText id="folhaInputText"  readonly="true" value="#{managerCriarProtesto.protocoloItem.folhas}"/>
                            </div>
                        </div>
                        <div class="row">
                            <div class="column1">
                                <p:outputLabel value="Interessado" for="interessadoInputText" />
                            </div>
                            <div class="column10">
                                <p:inputText id="interessadoInputText"  readonly="true" 
                                             value="#{managerCriarProtesto.protocolo.cliente.nome}" />
                            </div>
                        </div>

                        <div class="row">
                            <div class="column1">
                                <p:outputLabel value="Ato" for="itemprocessoInputText" />
                            </div>
                            <div class="column10">
                                <p:inputText id="itemprocessoInputText"  readonly="true" 
                                             value="#{managerCriarProtesto.protocoloItem.atoItem.descricao}">
                                </p:inputText>
                            </div>
                        </div>

                    </p:panel>
                </fieldset>
                <fieldset>
                    <legend> <h4 style="margin:0 0 10px 0">Ação</h4></legend>
                        <p:panel styleClass="column12" id="acaoPanel" 
                             style="background: none; border: none;" >

                        <div class="row">
                            <div class="column1">
                                <p:outputLabel value="Ação" />
                            </div>
                            <div class="column11">
                                <p:inputText readonly="true" 
                                             value="#{managerCriarProtesto.situacaoProtesto.tipoSituacaoProtesto.toString()}" />
                            </div>
                        </div>
                        <div class="row">
                            <div class="column1">
                                <p:outputLabel value="Descrição" for="descricao" />
                            </div>
                            <div class="column11">
                                <p:inputTextarea id="descricao" required="true" 
                                                 value="#{managerCriarProtesto.situacaoProtesto.observacao}" />
                            </div>
                        </div>
                        </p:panel>
                </fieldset>
                <div class="buttonAction">
                    <p:commandButton value="Salvar"
                                     process="@form"
                                     actionListener="#{managerCriarProtesto.salvarSituacaoProtesto(true)}"
                                     styleClass="ui-priority-primary"
                                     update="@form"
                                     icon="ui-icon-disk" />
                    <p:button value="Cancelar" icon="ui-icon-cancel" 
                              href="pesquisarProtesto.xhtml" />
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>



